package com.zub.config;

import java.util.List;
import java.util.Map;

/**
 * A simple MBean for working with configuration parameters.
 *
 * @author miken
 * @version 1.0 Jul 16, 2009
 */
public interface ConfigerAdapterMBean {
    /**
     * List all configured properties
     *
     * @return A list of all configured properties
     */
    List list();

    /**
     * Get all of the configured properties
     *
     * @return A map of all configured properties
     */
    Map getAll();

    /**
     * Can be used to set a Configer property via JMX.
     *
     * @param property
     * @param newValue
     * @throws RequiredConfigNotFoundException
     *          If the specified property does not exist in the set, this exception will be thrown.
     */
    void setConfig(String property, String newValue) throws RequiredConfigNotFoundException;

    /**
     * Get the value for a configuration property.  Property values can be set or overridden from the command line.  If
     * no default value is found, fall back to the default values specified in the map hard coded into this class.
     *
     * @param propertyName
     * @return The String value for the property or null if the property is not set.
     */
    String getConfig(String propertyName);

    /**
     * Returns the current environment
     * @return A String describing the current environment type
     */
    String getCurrentEnvironment();
}
